/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Controle;

import Interface.TelaPrincipal;

import event.DateEvent;
import event.DateEventListener;
import org.joda.time.DateTime;

/**
 *
 * @author Jean
 */
public class ControlaData {


    public ControlaData() {
        TelaPrincipal tela=new TelaPrincipal(this, new DateEventListener(){

            public void dateChanged(DateEvent evt) {

                if(!evt.getDateString().equals(""))
                System.out.println(evt.getDateString());
            }

        });
        
    }

    public int retornaDiaSemana(int mes, int ano){
        return new DateTime().withYear(ano).withMonthOfYear(mes+1).withDayOfMonth(1).getDayOfWeek();
    }

    public int retornaMesAtual(){
        return new DateTime().getMonthOfYear();
    }

    public int retornaAnoAtual(){
        return new DateTime().getYear();
    }

    public int retornaQtdDias(int mes, int ano){
     //tg
        return new DateTime().
                withYear(ano).
                withMonthOfYear(mes+1).
                withDayOfMonth(1).
                plusMonths(1).
                minusDays(1).getDayOfMonth();
    }    
}
